package com.leapp.sk.sever.personal

import com.example.util.ObjectProcessingUtil
import com.leapp.sk.bean.FeedBackEntity
import com.leapp.sk.bean.page.FeedBackListPageEntity
import com.leapp.sk.bean.response.personal.FeedBackListResponseEntity
import com.leapp.sk.viewdelegate.personal.FeedBackDelegate

/**
 * 反馈逻辑处理类
 * @author  chaohaipeng  on 2018/8/23.
 */
class FeedBackSever {
    private object mHolder {
        val instance = FeedBackSever()
    }
    companion object {
        fun getInstance(): FeedBackSever {
            return mHolder.instance
        }
    }
    /**
     * 获取数据
     */
    fun getFeedData( obj: FeedBackListResponseEntity?,viewDelegate: FeedBackDelegate?):List<FeedBackEntity>?{
        val dataPage: FeedBackListPageEntity = ObjectProcessingUtil.objMandatoryConversionClass(obj?.data, FeedBackListPageEntity::class.java)
        val records = dataPage?.records
        viewDelegate?.setLoadPageData(dataPage?.current,dataPage?.pages,dataPage?.total)
        return records
    }


}